Programming Arduino: Getting Started with Sketches (Tab) by Monk Simon

Programming Arduino: Getting Started with Sketches (Tab) by Monk Simon

Author:Monk, Simon [Monk, Simon]
Language: eng
Format: epub, pdf
Publisher: McGraw-Hill Education
Published: 2016-06-28T16:00:00+00:00


const int inputPin = 5;

void setup()

{

pinMode(inputPin, INPUT_PULLUP);

Serial.begin(9600);

}

void loop()

{

int reading = digitalRead(inputPin);

Serial.println(reading);

delay(1000);

}

Debouncing

When you press a pushbutton, you would expect that you would just get a single change from 1 (with a pull-up resistor) to 0 as the button is depressed. Figure 6-8 shows what can happen when you press a button. The metal contacts in the button bounce. So a single button press becomes a series of presses that eventually stabilize.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.